home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / ov_all.zip / TI637.ASC < prev    next >
Text File  |  1991-11-25  |  9KB  |  265 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  ObjectVision                           NUMBER  :  637
  9.   VERSION  :  1.0
  10.        OS  :  WIN
  11.      DATE  :  November 25, 1991                        PAGE  :  1/4
  12.  
  13.     TITLE  :  Flexible Selection Lists
  14.  
  15.  
  16.  
  17.  
  18.   Flexible Selection Lists:
  19.  
  20.   Selection lists are a field type which allow the user to choose
  21.   from a predefined group of choices.  The user is not permitted to
  22.   type in a new entry while completing the form.  Instead, one of
  23.   the available choices in the list must be selected.  Many times
  24.   users want to be able to add to the list dynamically as they fill
  25.   out a form.  If the field is connected to the index field of a
  26.   database there is a technique to allow adding new fields.
  27.  
  28.   One field on the form would be used to look up from the database
  29.   and would consequently be connected for reading from the database
  30.   (and displaying the choices in a list).  The other field would be
  31.   connected for writing to the database.  An additional button
  32.   which uses the Insert function will prevent users from
  33.   accidentally replacing an existing name with a new name.  Lastly
  34.   with a few extra steps the form can be made to prompt for the new
  35.   name when appropriate.
  36.  
  37.   This example builds a simple database with two fields to
  38.   illustrate the concept of a flexible selection list.  The
  39.   database will hold names and phone numbers.  The names will be
  40.   listed on the form so that the user may select from the list a
  41.   name and the matching phone number will appear automatically.
  42.   When a new name needs to be added to the list the form will allow
  43.   the user to type into a separate field and insert the name to
  44.   the database so that it will be placed in the list.
  45.  
  46.   1.   Create a form with two fields.  Call one Names and the other
  47.        Phone Numbers.
  48.  
  49.   2.   Create a database to store the names and numbers next.  Use
  50.        Tools | Links | Create, select Paradox.  When the dialog box
  51.        appears enter Lookup for the Link Name, FlexSel for the
  52.        table name and press TAB.  ObjectVision will prompt you with
  53.        an error message "Unable to open Paradox table.  Create a
  54.        new table named FLEXSEL?".  Choose "OK" to let ObjectVision
  55.        create a new table for you.  Let ObjectVision create the
  56.        buttons for you as you return to the form.  DBase users may
  57.        select DBase when creating the database, but will need to
  58.        type in the index name, Flexsel, as well.
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  ObjectVision                           NUMBER  :  637
  75.   VERSION  :  1.0
  76.        OS  :  WIN
  77.      DATE  :  November 25, 1991                        PAGE  :  2/4
  78.  
  79.     TITLE  :  Flexible Selection Lists
  80.  
  81.  
  82.  
  83.  
  84.   3.   Enter some data into the database to begin the selection
  85.        list.  Close the form tool (Form | Close Tool) and begin
  86.        entering names and numbers.  After typing in the name and
  87.        number be sure and press the Enter button on the form, then
  88.        press the Clear button on the form before adding the next
  89.        name and number.  You only need to add three or four names
  90.        before proceeding to the next step.  Enter Add Another Name,
  91.        with no phone number, as one of the entries into the
  92.        database.
  93.  
  94.   4.   Now that you have the form started, and a link to an indexed
  95.        database format the selection list field  Choose Tools |
  96.        Form.  Highlight the Names field and choose Properties |
  97.        Field Type | Selection List.  Notice the automatic box is
  98.        checked by default, the names entered earlier should fill in
  99.        the dialog box below.  Choose OK.
  100.  
  101.   5.   Two additional fields are necessary to complete the form:
  102.        Create a new field and call it New Name.  Place this field
  103.        to the right of the Names field.   Now create a second field
  104.        called Name Picked and place it below the Phone Numbers
  105.        field.
  106.  
  107.   7.   With the Name Picked field selected choose Tools | Tree.
  108.        Place a conclusion on the field of +Names (Objects |
  109.        Conclusion , +Names).  Then close the tree tool ( Tree |
  110.        Close Tool).
  111.  
  112.   8.   Cut the Name Picked field off of the form (Edit | Cut).
  113.        This field will hold the selected value in the background on
  114.        a scratchpad form.  Later the New Name field will check the
  115.        Name Picked field to find out which name was chosen.  This
  116.        will determine whether it is necessary to prompt for a new
  117.        entry to the list.
  118.  
  119.        Branching on the Name Picked field (rather than on the Names
  120.        field) prevents the decision tree from overriding the
  121.        database for automatically providing the selection list
  122.        values.  There are two ways to create an automatic selection
  123.        list, a decision tree or a database.  When a field is both
  124.        the branch node for a decision tree and connected to an
  125.        indexed field in a database the decision tree's values will
  126.        supersede the database values for the selection list.
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  ObjectVision                           NUMBER  :  637
  141.   VERSION  :  1.0
  142.        OS  :  WIN
  143.      DATE  :  November 25, 1991                        PAGE  :  3/4
  144.  
  145.     TITLE  :  Flexible Selection Lists
  146.  
  147.  
  148.  
  149.  
  150.        Checking on the dummy field Name Picked allows the Names
  151.        list to continue getting values from the database.
  152.  
  153.   9.   Now modify the link to read to a different field than it
  154.        writes from.  Use Tools | Links to alter the connections
  155.        between the form and the database.  Choose Modify on the
  156.        Lookup link.  Highlight the Names field and press Connect.
  157.        Choose OK to leave the Names field in the database connected
  158.        to read to the Names field on the form.  A second dialog box
  159.        will appear to prompt for the write field.  Choose the New
  160.        Name field from the list and press OK.  Press OK until the
  161.        form is back on the screen.
  162.  
  163.   10.  Create a third field (which will be formatted as a button in
  164.        a moment).  Call the new field Add New Name and place the
  165.        field down at the bottom of the form under the Enter button.
  166.        Use Properties | Field Type | Button to set this field as a
  167.        button.
  168.  
  169.   11.  This button needs a decision tree conclusion of
  170.        @Insert("Lookup").  Use Tree | Tool, then Objects |
  171.        Conclusion to create the decision tree.  Be sure to use the
  172.        same linkname that was used earlier, Lookup, and enclose it
  173.        in double quotes.
  174.  
  175.   Note The last step is to build a decision tree on the New Name
  176.        field to indicate when to enter a new name to the list.  The
  177.        decision tree needs a particular condition to indicate that
  178.        the new record is necessary,.  The "dummy" record in the
  179.        database, Add Another Name, will be the indicator.  If the
  180.        dummy record is selected the decision tree will cause the
  181.        New Name field to be prompted.  If any other name is
  182.        selected, the New Name field will be skipped.
  183.  
  184.   12.  In the tree tool (Tools | Tree) select the New Name field
  185.        (Tree | Select | New Name) and choose Objects | Branch.
  186.        Branch on the field called Name Picked.  Select Objects |
  187.        Conclusion and when prompted for the Condition of the
  188.        Conclusion type Add Another Name, after pressing the Return
  189.        (or Enter) key on the keyboard a dialog box will appear
  190.        requesting the Conclusion.  Type +New Name.  Choose Objects
  191.        | Conclusion a second time and type Otherwise as the
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.   PRODUCT  :  ObjectVision                           NUMBER  :  637
  207.   VERSION  :  1.0
  208.        OS  :  WIN
  209.      DATE  :  November 25, 1991                        PAGE  :  4/4
  210.  
  211.     TITLE  :  Flexible Selection Lists
  212.  
  213.  
  214.  
  215.  
  216.        condition and +Names as the Conclusion.  Your application is
  217.        complete.
  218.  
  219.        If the desired name is in the list, select it and the
  220.        accompanying phone number will appear.  If the name desired
  221.        is not in the list and needs to be added, select from the
  222.        list Add Another Name, the cursor should pause at the New
  223.        Name field before proceeding.  Because Add Another Name is
  224.        one of the records in the database (complete with a blank
  225.        phone number), the user must use the TAB key or mouse to
  226.        advance to the phone number field.  This field is assumed
  227.        complete by ObjectVision since a blank value was delivered
  228.        back from the database.   After typing both the name and the
  229.        number the user should press the Add New Name button to
  230.        write the new entry to the database.  At this time the new
  231.        entry will be available in the selection list.
  232.  
  233.   The basic idea here is that a selection list is a field which is
  234.   initially read-only.  By assigning a different field  on the form
  235.   for writing than for reading, additional entries can be made.
  236.   The purpose of adding a button with the Insert function on it is
  237.   to prevent accidentally replacing an existing record with the new
  238.   record.  A dummy record  in the database is used to trigger the
  239.   form to pause on a field which would otherwise be skipped.
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.